// 定义函数类型：其实就是定义函数的参数和返回值的类型
function add(x: number, y: number): number {
  const result = x + y;
  return result;
}

const add1 = (x: number, y: number): number => x + y;

const add2: (x: number, y: number) => number = (x, y) => x + y;

const add3 = function (x: number, y: number): number {
  return x + y;
};

const add4: (x: number, y: number) => number = function (x, y) {
  return x + y;
};

interface Add {
  (x: number, y: number): number;
}

const add5: Add = (x, y) => {
  return x + y;
};
